<%@ page language="java" isELIgnored="false" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>单航线抓取统计——恒拓运价魔方</title>

<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/show.js"></script>
<link href="<%=request.getContextPath()%>/fare/css/base.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/fare/js/jquery-1.6.4.min.js"></script>
<link href="<%=request.getContextPath() %>/fare/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link rev="stylesheet" media="all" href="<%=request.getContextPath() %>/fare/css/form_style.css" type="text/css" rel="stylesheet">

<link href="<%=request.getContextPath() %>/fare/css/base.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/datePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/fare/lib/ligerUI/js/ligerui.min.js"></script>
<script src="<%=request.getContextPath() %>/fare/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
<script	src="<%=request.getContextPath()%>/fare/lib/jquery/jquery.form.js"	type="text/javascript"></script>
<!-- 圆角文本框 -->
<%-- <link href="<%=request.getContextPath() %>/fare/css/htc/htc.css" rel="stylesheet" type="text/css" /> --%>
<style type="text/css">
<style type="text/css">
.tooltips{
text-decoration:none;
position:relative;
z-index:2;
}
.tooltips:hover{
z-index:3;
background:none;
}
.tooltips span{
display: none;
}
.tooltips:hover span{
z-index:99999;
display:block;
position:absolute;  
margin:-20px -10px 0px -25px; border:0;
clear:both;
overflow:hidden;
margin:0;
padding:0;
border:1px solid black;
background-color:#DCDCDC;
padding:3px;
color:black;
}
</style>	
</style>
<script type="text/javascript">

$(document).ready(function(){
//	todaty=new Date();
	var mapVo=new Object();
	mapVo=${json};
	var table=$("#username");
	$(table).empty();
	var rowSize=7;//一行容纳多少行
	//处理非正常抓取
	var bnormalList=new Array();
	bnormalList=${listStr};
	var listSizes=bnormalList.length;
	
	for(var i=0;i<(30+listSizes);i++){
		if(i%rowSize==0){
			table.append("<tr></tr>");
		}
		
		if(i !=0){
			if(bnormalList.length>0){
				if(i>=30 ){
					var addSize=bnormalList[i-30];
					todaty=new Date();
					todaty.setDate(todaty.getDate()+addSize);
					today=todaty;
				}else{
					today.setDate(today.getDate()+1);
				}
			}else{
				today.setDate(today.getDate()+1);
			}
		}
		
		var yesars=today.getFullYear();
		var months=today.getMonth()+1;
		var days=today.getDate();
		if(months<10){
			months='0'+months;
		}if(days<10){
			days='0'+days;
		}
		var key=yesars+'-'+months+'-'+days;
		var result=false;
		
		for(k in mapVo){
			var data=mapVo[k];
			if(data[key] !=null){
				result=true;
				break;
			}
		}
		
		if(result){
			$("tr:last",table).append("<td style='padding:5px 5px 5px 0px;border:1px solid;text-align:center;height:40px;'>"+(today.getMonth()+1+'月'+today.getDate()+'日')
			+"</td>");
		}else{
			$("tr:last",table).append("<td  bgcolor='#FFC78E'  style='padding:5px 5px 5px 0px;border:1px solid;text-align:center;height:40px;'>"+(today.getMonth()+1+'月'+today.getDate()+'日')
			+"<br/><font color='#4A4AFF'>呀！数据没有抓到！</font></td>");
		}
		
	}
});


function checkForm(){
	
var flag=true;
	
	if ($("#depCity").val() == ''||$("#arrCity").val() == '') {
		flag = false;
		alert("请设置正确的出发地和目的地");
		return;
	}    		
	if ($("#depCity").val() == '中文/拼音'||$("#arrCity").val() == '中文/拼音') {
		flag = false;
		alert("请设置正确的出发地和目的地");
		return;
	}
	if($("#depCity").val() ==$("#arrCity").val()){
		flag = false;
		alert("请设置正确的出发地和目的地");
	}
	return flag;
	
}

//打开历史数据页面
function showHistoryData(v1,v2){
	var depCitys=v1;
	var arrCitys=v2;
	var url='<%=request.getContextPath() %>/crawlInfoAction!findHistoryData.action?depCity='+depCitys+'&arrCity='+arrCitys;
	//在当前窗口重新打开一个
	parent.f_addTab("crawl_history","历史数据", url);
}

function find(){
	if(checkForm()){ 
		var url='<%=request.getContextPath() %>/crawlInfoAction!findSingleLine.action';
		//在当前窗口重新打开一个
		parent.f_addTab("single_line_statistics","单航线抓取当日统计", url);
		
	}
}
function get_lastDate(ymd,ym,n){  
    ymd=ymd?new Date(ymd.replace(/-/g,"/")):new Date();  
    ym&&(ym=="y"?ymd.setFullYear(ymd.getFullYear()-1):ymd.setMonth(ymd.getMonth()-1));  
    n&&ymd.setDate(ymd.getDate()+n);  
    return ymd.toLocaleDateString().match(/\d+/g).join('-');  
}  


</script>
</head>

<body>
	<div class="form_body">
		<div class="main_max">
		
			<div class="form_table_tltle"  >单航线抓取当日统计</div>
			
			
			<div class="high_10"></div>
			
			<form action="" id="page_form">
				<table width="0" border="0" cellspacing="0" cellpadding="0" class="form_list">
					<tr >
						<td  align="left" height="15px" style="font-size:20px ;border-right:none;" width="300px">${depCityName}(${depCity})——${arrCityName }(${arrCity}) @ ${Reportgrabchannel }</td>
					</tr>
					<tr>
						<td style="border-right:none;"> 
						<script language=JavaScript> 
							today=new Date(); 
							document.write(  
							today.getFullYear(),"-", 
							today.getMonth()+1,"-", 
							today.getDate(),"  " ); 
							</script>
							第${indexs }次抓取</td>
					</tr>
					<tr>
						<td style="border-right:none;"> 开始时间：${finishedStartTimeStr}</td>
						<td style="border-left:none;">  结束时间：${finishedEndTimeStr}</td>
					</tr>
					<tr>
						<td style="border-right:none;"> 抓取成功率：${successRate }%</td>
						<td style="border-left:none;"> 数据完整性：${dataTotalRate }%</td>
					</tr>
				</table>
			
			</form>
			
			<div class="high_10"></div>
			<form action="" id="page_form">
			<table width="0" border="0" cellspacing="0" cellpadding="0" class="form_list" id="username" name="">
				
			</table>
		
		</form>
			
		</div>
		
	</div>

</body>
</html>

